% stratified random sampling by rbf_type

nrep = 1000;

for j = 1:nrep

    final_index = [];

    rbf_zero_index = find(data{:,3} == 0);
    sample_zero_index = datasample(rbf_zero_index, floor(numel(rbf_zero_index) * 50/100), 'replace', false);

    rbf_not_zero_index = find(data{:,3} > 0);
    sample_not_zero_index = datasample(rbf_not_zero_index, floor(numel(rbf_not_zero_index) * 50/100), 'replace', false);

    final_index = [sample_zero_index' sample_not_zero_index'];

    q1(j) = sum(data{final_index,6});
    q2(j) = sum(data{final_index,7});
    q3(j) = sum(data{final_index,8});
    q4(j) = sum(data{final_index,9});
end

mean(q1)/numel(final_index) * 100
mean(q2)/numel(final_index) * 100
mean(q3)/numel(final_index) * 100
mean(q4)/numel(final_index) * 100
